function [R,C,sens]=celdas_dobleTLP(wp,qp,g,wz,seteados)
%Seteo R1 y R5

    R=ones(5,1);
    C=ones(4,1);
    
    R(1)=seteados(1);
    R(5)=seteados(2);
    
    R(2)=R(1);
    R(3)=R(1)/2;
    R(4)=R(5)*(g-1);
    C(1)=1/(wz*R(1));
    C(2)=C(1);
    C(3)=2*C(1);
    C(4)=(1/2)*((1/(qp*wp*R(1)))+4*C(1)*(g-1));
   
    sens=ones(9,4);
    sens(:,1)=SenDTTLPW0(R(1),R(2),R(3),R(4),R(5),C(1),C(2),C(3),C(4));
    sens(:,2)=SenDTTLPQ(R(1),R(2),R(3),R(4),R(5),C(1),C(2),C(3),C(4));
    sens(:,3)=SenDTTLPG(R(1),R(2),R(3),R(4),R(5),C(1),C(2),C(3),C(4));
    sens(:,4)=SenDTTLPWz(R(1),R(2),R(3),R(4),R(5),C(1),C(2),C(3),C(4));    
end

function [senw0]=SenDTTLPW0(R1,R2,R3,R4,R5,C1,C2,C3,C4)
    Ra=R4;
    Rb=R5;
    R=R1;
    Cx=C4;
    C=C1;
    senw0(1)=-(2/5)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(2)=-(2/5)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(3)=-(1/5)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(4)=0;
    senw0(5)=0;
    senw0(6)=-(1/4)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(7)=-(1/4)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(8)=-(2/4)/(C^2*R^2*(1/(C^2*R^2)));
    senw0(9)=0;
end

function [senQ]=SenDTTLPQ(R1,R2,R3,R4,R5,C1,C2,C3,C4)

    Ra=R4;
    Rb=R5;
    R=R1;
    Cx=C4;
    C=C1;

    senQ(1)=-(2/5)*(2*R^2*(Rb/(2*R^2*(2*C*Ra - Cx*Rb)*(1/(C^2*R^2))^(1/2)) - Rb/(2*C^2*R^4*(2*C*Ra - Cx*Rb)*(1/(C^2*R^2))^(3/2)))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*Rb)*(1/(C^2*R^2))^(3/2)))*(1/(C^2*R^2))^(1/2))/Rb;
    senQ(9)=(Cx*Rb)/(2*C*Ra - Cx*Rb);

end

function [senwz]=SenDTTLPWz(R1,R2,R3,R4,R5,C1,C2,C3,C4)
    senwz(1)=-2/5;
    senwz(2)=-2/5;
    senwz(3)=-1/5;
    senwz(4)=0;
    senwz(5)=0;
    senwz(6)=-1/4;
    senwz(7)=-1/4;
    senwz(8)=-2/4;
    senwz(9)=0;
end

function [senG]=SenDTTLPG(R1,R2,R3,R4,R5,C1,C2,C3,C4)

    senG(1)=0;
    senG(2)=0;
    senG(3)=0;
    senG(4)=R4/(R4 + R5);
    senG(5)=-(R5^2*((R4 + R5)/R5^2 - 1/R5))/(R4 + R5);
    senG(6)=0;
    senG(7)=0;
    senG(8)=0;
    senG(9)=0;

end